package models

import (
	"fmt"
	"github.com/go-redis/redis"
	"shop/conf"
)

type (
	RedisDB *redis.Client
)

func RedisConfig() {
	redisConfig := conf.Conf.RedisConfig
	Redis := redis.NewClient(&redis.Options{
		Addr:     redisConfig.Addr,
		Password: redisConfig.Password,
		DB:       redisConfig.Db,
	})
	err = Redis.Ping().Err()
	if err != nil {
		fmt.Println("redis连接失败")
		return
	} else {
		fmt.Println("redis连接成功")
	}
}
